import { effect, effectScope, signal } from "alien-signals";

const count = signal(1);

const stopScope = effectScope(() => {
  const cleanup = effect(() => {
    console.log(`Count in scope: ${count()}`);
  }); // Console: Count in scope: 1
  effect(() => {
    console.log(`scope cleanup ${(cleanup(), "")}`);
  });
});

count(2); // Console: Count in scope: 2

stopScope();
console.log("scope stoped");

count(3); // No console output
console.log("set count 3");
